package com.tim.app.ui.adapter.personal;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.application.library.util.TimeUtil;
import com.application.library.widget.recycle.BaseRecyclerAdapter;
import com.tim.app.R;
import com.tim.app.server.entry.IncomeDetailsBean;
import com.tim.app.server.entry.WithdrawalRecoderBean;
import com.tim.app.server.result.WithdrawalBean;
import com.tim.app.util.AppDate;

import java.util.List;

/**
 * Created by wdy on 2017/8/22.
 */

public class WithdrawalRecoderAdapter extends BaseRecyclerAdapter<WithdrawalRecoderAdapter.ViewHolder, WithdrawalBean.ResBean.ArraylistBean.ResultBean> {
    public WithdrawalRecoderAdapter(Context context, List<WithdrawalBean.ResBean.ArraylistBean.ResultBean> mDataList) {
        super(mDataList);
    }

    @Override
    public WithdrawalRecoderAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        ViewHolder holder = new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_withdrawalrecoder, parent, false));
        return holder;
    }

    @Override
    public void onBindViewHolder(WithdrawalRecoderAdapter.ViewHolder holder, int position, WithdrawalBean.ResBean.ArraylistBean.ResultBean data) {
        holder.mTv_income_type.setText("微信提现"+data.getMoney() + "元");
        String s = AppDate.changemoney.get(data.getIsApprove()) == null ? data.getIsApprove() : AppDate.changemoney.get(data.getIsApprove());
        holder.mTv_status.setText(s);
        holder.mTv_time_day.setText(TimeUtil.dateToStamp(data.getDepositTime() + ""));
        holder.mTv_time_hour.setText(TimeUtil.dateToHour(data.getDepositTime() + ""));
    }

    public static class ViewHolder extends BaseRecyclerAdapter.BaseRecyclerViewHolder {
        TextView mTv_income_type;
        TextView mTv_time_day;
        TextView mTv_time_hour;
        TextView mTv_status;

        public ViewHolder(View itemView) {
            super(itemView);
            mTv_income_type = (TextView) itemView.findViewById(R.id.tv_income_type);
            mTv_time_day = (TextView) itemView.findViewById(R.id.tv_time_day);
            mTv_time_hour = (TextView) itemView.findViewById(R.id.tv_time_hour);
            mTv_status = (TextView) itemView.findViewById(R.id.tv_status);
        }
    }
}
